package com.ingrun.tuboshu;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Objects;

@SpringBootApplication
@MapperScan("com.ingrun.tuboshu.mapper")
@Slf4j
public class TuboshuApplication {


    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext app = SpringApplication.run(TuboshuApplication.class, args);

        ConfigurableEnvironment env = app.getEnvironment();
        String pathProperty = env.getProperty("server.servlet.context-path");
        String path = pathProperty == null || Objects.equals("/", pathProperty) ? "" : pathProperty;
        log.info("(♥◠‿◠)ﾉﾞ  土拨鼠统一认证中心启动成功   ლ(´ڡ`ლ)ﾞ  ");
        log.info("(♥◠‿◠)ﾉﾞ  swagger ： http://{}:{}{}/doc.html   ლ(´ڡ`ლ)ﾞ  \n", InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"), path);
    }


}
